///////////////////////////////////////////////////////////////////////////////
//! @file	: image_scaling.cl
//! @date   : 2016/03/04
//! @author: guyadong
//! @brief  : zoom an image
////////////////////////////////////////////////////////////////////////////////
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP | CLK_FILTER_LINEAR;
__kernel void image_scaling(__read_only image2d_t sourceImage
                            ,__write_only image2d_t destinationImage
                            ,const float2 normalization_factor){
	int2 pos=(int2)(get_global_id(0),get_global_id(1));		
	float2 norm_pos=convert_float2(pos) * normalization_factor;
	float4 color=read_imagef(sourceImage, sampler, norm_pos);
	write_imagef(destinationImage, pos, color);
}